/**
* 版权声明：厦门睿商网络科技有限公司 版权所有 违者必究
* 日    期：2020-02-17
*/
package com.rzico.order.entity;

import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;

/**
 * <pre>
 *   送货单项数据库对象
 * </pre>
 * @author Rzico Boot
 * @version 1.0
 */
@Data
@Table(name = "wx_shipping_item")
public class ShippingItem {

    @ApiModelProperty(value = "")
    @Id
    protected Long id;

    @ApiModelProperty(value = "创建日期")
    protected java.util.Date createDate;

    @ApiModelProperty(value = "修改日期")
    protected java.util.Date modifyDate;

    @ApiModelProperty(value = "成本价")
    protected java.math.BigDecimal cost;

    @ApiModelProperty(value = "商品名称")
    protected String name;

    @ApiModelProperty(value = "类型 {0.产品,1:套餐,2:水票,3.压桶}" )
    protected Integer subType;

    @ApiModelProperty(value = "销售价")
    protected java.math.BigDecimal price;

    @ApiModelProperty(value = "数量")
    protected BigDecimal quantity;

    @ApiModelProperty(value = "回桶数量")
    protected BigDecimal emptyBarrelQuantity;

    @ApiModelProperty(value = "活动折扣金额")
    protected java.math.BigDecimal discount;

    @ApiModelProperty(value = "商品条码")
    protected String sn;

    @ApiModelProperty(value = "商品规格")
    protected String spec;

    @ApiModelProperty(value = "商品规格")
    protected String unit;

    @ApiModelProperty(value = "商品规格")
    protected String thumbnail;

    @ApiModelProperty(value = "商品编号")
    @Column(name = "product_id")
    protected Long productId;

    @ApiModelProperty(value = "送货单")
    @Column(name = "shipping_id")
    protected Long shippingId;

    @ApiModelProperty(value = "仓库")
    protected Long enterpriseId;

    @ApiModelProperty(value = "运单号")
    protected String trackingNo;

    @ApiModelProperty(value = "物流费用(所有)")
    protected java.math.BigDecimal shippingFreight;

    @ApiModelProperty(value = "送货工资(含楼层费)")
    protected java.math.BigDecimal adminFreight;

    @ApiModelProperty(value = "楼层费")
    protected java.math.BigDecimal levelFreight;

    @ApiModelProperty(value = "第三方单品订单号" )
    protected String subTranSn;

    @ApiModelProperty(value = "商品金额")
    public BigDecimal getAmount(){
        return this.getPrice().multiply(this.getQuantity()).setScale(6);
    }

    public void setAmount(BigDecimal value) {

    }

    @ApiModelProperty(value = "实收金额")
    public BigDecimal getSubTotal(){
        return this.getPrice().multiply(this.getQuantity()).subtract(getDiscount()).setScale(6);
    }

    public void setSubTotal(BigDecimal value) {

    }

    public void setSubCost(BigDecimal value) {

    }

    @ApiModelProperty(value = "结算金额")
    public BigDecimal getSubCost(){
        return this.getCost().multiply(this.getQuantity()).setScale(6);
    }


}
